#ifndef CDB_TO_INP_CONVERTOR
#define CDB_TO_INP_CONVERTOR

#include "convertor.h"

class CdbToInpConvertor: public Convertor {
struct Node {
    int id;
    double x;
    double y;
    double z;
};

struct Element {
    int id;
    int type;
    int propertyID;
    std::vector<int> nodes;
};

struct Property {
    int id;
    std::string type;
    double thickness;
    int materialId;
};

public:
    CdbToInpConvertor();
    virtual ~CdbToInpConvertor();
    virtual int convert(const std::string &cdbPath, const std::string &bdfPath) override;

private:
    int parseCdbFile(const std::string &path);

    int generateInpFile(const std::string &path);

    void trim(std::string& s);

    void parseNode(const std::string &line);
    void parseElement(const std::string &line);
    void parsePropert(const std::string &line);
private:
    std::vector<Node> gridNodes;
    std::vector<Element> gridElements;
    std::vector<Property> properties;
};

#endif

